<html lang="en">
    <head>
        <meta charset="utf-8">


	<!-- (en) Add your meta data here -->
	<!-- (de) Fuegen Sie hier ihre Meta-Daten ein -->
	<link href="<?php echo $basePath; ?>/admin_media/css/layout_3col_standard.css" rel="stylesheet" type="text/css"/>
	<!--[if lte IE 7]>
	<link href="<?php echo $basePath; ?>/admin_media/css/patches/patch_3col_standard.css" rel="stylesheet" type="text/css" />
	<![endif]-->

	<script type="text/javascript" src="<?php echo $basePath; ?>/library/jquery/jquery.js"></script>
	<link type="text/css" href="<?php echo $basePath; ?>/library/jquery-ui/themes/redmond/jquery-ui.css" rel="stylesheet" />	
	<script type="text/javascript" src="<?php echo $basePath; ?>/library/jquery-ui/ui/jquery-ui-all-in-one.js"></script>

<script type="text/javascript">

<?php if(isset($close)): ?>

window.opener.location.href = '<?php echo $opener_url; ?>';
self.close();

<?php else: ?>

 $(document).ready(function() {

    $('#loading').hide();

    $('')
        $('#loading')
        .ajaxStart(function() {
        $(this).show();
        }).ajaxStop(function() {
        $(this).hide();
        });

    var opener = [];
    var closer = [];

    $('#loading').hide();
    $("a.opener").live('click', function(){
    
        //$this.preventDefault();

        var id_parent = $(this).attr("id").replace("p_","");

        if(closer[id_parent])
        {
            $('#p_' + id_parent).next("ul").slideDown("slow");
            closer[id_parent] = null;
            opener[id_parent] = true;
            $('#p_' + id_parent).attr("aria-expanded", "true");
            $('#p_' + id_parent).prev().prev("span").text("- ");
            return;
        }

        if(opener[id_parent])
        {
            closer[id_parent] = true;
            $('#p_' + id_parent).next("ul").slideUp("slow");
            $('#p_' + id_parent).attr("aria-expanded", "false");
            $('#p_' + id_parent).prev().prev("span").text("+ ");
            opener[id_parent] = null;
            return;
        }

        $.ajax({
          type: "POST",
          url: "<?php echo $basePath; ?>/<?php echo $adminAreaToken; ?>/ajax-project-get-childs-html",
          data: ({id_parent  : id_parent,
                  id_project    : "<?php echo $id_project; ?>",
                  input_type : "<?php echo $input_type; ?>",
                  id_value   : "<?php echo $id_value; ?>"}),
          success: function(data) {
             $('#p_' + id_parent).attr("aria-expanded", "true");
             $('#p_' + id_parent).prev().prev("span").text("- ");
             $('#p_' + id_parent).after(data).slideDown("slow");
             opener[id_parent] = true;
          },
          error: function(data) {
          alert();
            console.log(data);
          }
        });
    });

 });

<?php endif; ?>

</script>

<body>

<div id="main">

	<!-- begin: main content area #main -->
	<div class="page_margins">
	  <div class="page" id="main_content">

		  <!-- begin: #col3 static column -->
		  <div id="col3">

			<div id="col3_content" class="clearfix">
			  <!-- skiplink anchor: Content -->
				<!--#######################-->
				<!-- BEGIN: Module content -->
				<!--#######################-->
				<div id="module_content" role="main">
				    <a name="content"></a>

<form name="setup" id="setup" method="post" action="<?php echo $basePath; ?>/<?php echo $adminAreaToken; ?>/project-select/submit" accept-charset="utf-8">

<input type="hidden" name="callback_num" value="<?php echo $callback_num; ?>" />

<div class="page2">

<div class="floatbox">

<h2 class="page2_header">Select project</h2>
</div>

            <input role="button"
                   aria-labelledby="sub"
                   type="submit"
                   name="submit
                   id="submit"
                   value="Submit" />

<div id="tree">
<ul role="tree" aria-expanded="true" wairole="tree">
<li><input <?php if($input_type == 'checkbox'): ?>
                           type="checkbox" name="_id_project[]"
                         <?php else: ?>
                           type="radio" name="_id_project"
                         <?php endif; ?>
                           value="0" />
        <a href="#none" role="treeitem" aria-expanded="true" wairole="treeitem">Root</a>

  <ul aria-expanded="false">
  <?php foreach($project_result as $project): ?>
  <?php if($id_value != $project['id_project']): ?>
  <li><span>+</span><input <?php if($input_type == 'checkbox'): ?>
           type="checkbox" name="_id_project[]"
         <?php else: ?>
           type="radio" name="_id_project"
         <?php endif; ?>
           value="<?php echo $project['id_project']; ?>" />
        <a href="#none" role="treeitem" aria-expanded="false" wairole="treeitem" class="opener" id="p_<?php echo $project['id_project']; ?>"><?php echo $project['title']; ?></a>
  </li>
  <?php endif; ?>
  <?php endforeach; ?>
  </ul>

</li>
</ul>
</div>

</div>

            <input role="button"
                   aria-labelledby="sub"
                   type="submit"
                   name="submit
                   id="submit"
                   value="Submit" />

</form>



				</div>
				<!--#####################-->
				<!-- END: Module content -->
				<!--#####################-->
			</div>

			<div id="ie_clearing">&nbsp;</div>
			<!-- End: IE Column Clearing -->
		  </div>
		  <!-- end: #col3 -->
	  </div>
	</div>
	
	<!-- end: #main -->

	<!-- begin: #footer -->
	<div id="footer">
		<div class="page_margins">
			<div class="page">
			  GeoContexter <br />Layout based on <a href="http://www.yaml.de/en">YAML</a>
			</div>
		</div>
	</div>
	<!-- end: #footer -->

</div>
</body>
</html>